JavaScript

{grid.object}setStateInfo Method

IN THIS PAGE

Syntax

{Grid.Object}.setStateInfo(obj)

Arguments

obj

A JSON object that specifies what data you want to store in the state object.

Description

Allows you to store arbitrary data in the Grid Component's 'state' object.

Discussion

The data in the 'state' object is submitted along with the data in the Grid controls every time you submit the Grid, or make an Ajax callback. The data will be in the __si2 variable.

Example

{Grid.object}.setStateInfo({myvar1: 'value for myvar1', myvar2: 'value for myvar2'});

TIP: If you are using Xbasic to construct the Javascript .setStateInfo() command in an Ajax callback, you might find the Xbasic varToJSON() function to be useful. For example:

dim ar as p
ar.myvar1 = "value for myvar1"
ar.myvar2 = "value or myvar2"
dim jscmd as c 
'.t. flag condenses JSON object to a single line
jscmd = "{grid.object}.setStateInfo(" + varToJSON(ar,.f.,.t.) + ");"

See Also